package com.qf.blog.auth;

import com.qf.blog.entity.User;

/**
 * 用ThreadLocal来管理登录用户的信息
 */
public class LoginThreadLocal {
    private static ThreadLocal<User> userThreadLocal = new ThreadLocal<>();

    public static void set(User user){
        userThreadLocal.set(user);
    }

    public static User get(){
        return userThreadLocal.get();
    }

    public static void remove(){
        userThreadLocal.remove();
    }
}
